﻿using ChainResponsibility.Model;
using System;

namespace ChainResponsibility
{
    class Program
    {
        static void Main(string[] args)
        {
            ///例子：某企业而得SCM系统中包含一个采购审批子系统。
            ///该企业的采购审批时分批进行的，即根据采购金额的不同由不同层级的主管人员来审批，
            ///主任可以审批5万元以下的采购单，
            ///董事长可以审批5万元到10万元的采购单，
            ///100万元以上需要开会决定，
            ///请使用责任链模式模拟该系统。

            Director director = new Director("director");
            VicePresident vicePresident = new VicePresident("vicePresident");
            President president = new President("president");
            Congress congress = new Congress("congress");
            director.SetApprover(vicePresident);
            vicePresident.SetApprover(president);
            president.SetApprover(congress);
           
            director.Operation(new PurchaseArgs()
            {
                ObjectName = "玩具",
                TotalMoney = 1000,
            });
            director.Operation(new PurchaseArgs()
            {
                ObjectName = "桌子",
                TotalMoney = 20000,
            });
            director.Operation(new PurchaseArgs()
            {
                ObjectName = "电视",
                TotalMoney = 500000,
            });
            director.Operation(new PurchaseArgs()
            {
                ObjectName = "工厂",
                TotalMoney = 9000000,
            });
            Console.WriteLine("Hello World!");
        }
    }
}
